users = {'user1': '2223334', 'user2': '1113334'}
books_in = {',计算机导论', '人文与沟通', '数据结构', '机器学习', 'Python编程', '算法导论'}
books_out = {'c语言', '窄门', '道德与法治', '小王子'}
user_books = {'user1': ['c语言', '小王子'], 'user2': ['窄门', '道德与法治']}

while True:
    user_name = input('请输入用户名')
    user_key = input('请输入密码')
    if user_name in users:
        if users[user_name] == user_key:
            print('登录成功，欢迎使用诚信数字图书馆！')
        else:
            print('用户名或者密码错误')

    while True:
        print('1. 修改密码')
        print('2. 借书')
        print('3.还书')
        print('4. 查看我的书籍')
        print('5.查看图书记录')
        print('6. 退出图书馆系统')
        choice = input('请输入操作对应的序号')
        if choice == '1':
            new_key = input('请输入新密码')
            users[user_name] = new_key
            print('修改成功')
            print(users)
        elif choice == '2':
            print('当前图书馆藏书')
            print(books_in)
            book = input('请输入要借阅的书籍')
            if book in books_in:
                books_in.remove(book)
                books_out.add(book)
                books_out.add(book)
                print('借阅成功')
            else:
                print('图书馆中没有您想借阅的书籍')
                print('请重新输入您要借阅的书籍')
        elif choice == '3':
            print('以下是您借阅的书籍')
            print(user_books[user_name])
            book = input('请输入您要归还的书籍')
            if book in user_books[user_name]:
                user_books[user_name].remove(book)
                books_out.remove(book)
                books_in.add(book)
                print('归还成功')
        elif choice == '4':
            print(user_books[user_name])
        elif choice == '5':
            print(books_in)
            print(books_out)
            print(user_books[user_name])
        elif choice == '6':
            print('知识是人类进步的阶梯\n欢迎您下次使用诚信数字图书馆')
        else:
            print('请输入正确的序号')


pass